package com.method;

/**
 * @Author WaveHi
 * @Date 29/7/2021 下午 2:52
 * @Version 1.0
 * @Contact HJBWaveHi@163.com
 * @Description
 */
public class MethodDemo {

    public static void main(String[] args) {

        //创建数组用于测试
        int[] nums = {32,23,3,343,41};

        //测试
        System.out.println("nums[0] = " + nums[0]);
        MethodDemo.change1(nums);
        System.out.println("nums[0] = " + nums[0]);

        //测试
        System.out.println("nums[0] = " + nums[0]);
        MethodDemo.change(nums[0]);
        System.out.println("nums[0] = " + nums[0]);





    }

    /**
     * 将传进的参数的值改为一定的值
     * @param num 需改变的值
     */
    public static void change(int num) {

        //改变参数的值
        num = 20;

    }

    /**
     *改变数组的第一个值
     * @param arr 需改变值的数组
     * @return 无意义返回值
     */
    public static int change1(int[] arr) {

        arr[0] = 100;

        return 0;

    }

}
